| afnuke2.inc 02/15/06 3:30pm est 

Sub Obstacle 
/echo Obstacle detected, moving around it 
/keypress forward 
/keypress back hold 
/delay 3 
/keypress back 
/if (${Math.Rand[100]}+1>50) { 
/keypress strafe_right hold 
} else { 
/keypress strafe_left hold 
} 
/delay 5 
/keypress strafe_right 
/keypress strafe_left 
/keypress forward hold 
/return 

Sub Leash 
/if (${Spawn[${leashholder} PC].Type.Equal[Corpse]}) /return
/if (${doleash}>0) { 
/if (${leashholder.Equal[Nobody]}) { 
/if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>${leashlength}) { 
:FollowingLoop1 
/varset X ${Me.X} 
/varset Y ${Me.Y} 
/squelch /face fast nolook loc ${stakeY},${stakeX} 
/if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>10) { 
/keypress forward hold 
/delay 2 
/if ((${Me.X}==${X}) && (${Me.Y}==${Y})) /call Obstacle 
} 
/if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<=10) /keypress back 
/if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>10) { 
/goto :FollowingLoop1 
} else { 
/keypress forward 
/keypress back 
/squelch /face fast nolook loc ${stakeY},${stakeX} 
/goto :end 
} 
} 
} 
/if (!${leashholder.Equal[Nobody]}) { 
/if ((${Spawn[${leashholder} PC].ID})&&(${Spawn[${leashholder} PC].Distance}>${leashlength})) { 
:FollowingLoop2 
/varset X ${Me.X} 
/varset Y ${Me.Y} 
/squelch /face fast nolook id ${Spawn[${leashholder} PC].ID} 
/if (${Spawn[${leashholder} PC].Distance}>10) { 
/keypress forward hold 
/delay 2 
/if ((${Me.X}==${X}) && (${Me.Y}==${Y})) /call Obstacle 
} 
/if (${Spawn[${leashholder} PC].Distance}<=10) /keypress back 
/if (${Spawn[${leashholder} PC].Distance}>10) { 
/goto :FollowingLoop2 
} else { 
/keypress forward 
/keypress back 
/squelch /face fast nolook id ${Spawn[${leashholder} PC].ID} 
/goto :end 
} 
/if (!${leashholder.Equal[Nobody]} && !${Spawn[${leashholder} PC].ID}) { 
/echo - Leashholder DEAD or ZONED! Leash is BROKEN! 
/varset doleash 0 
/varset leashholder Nobody 
/ini "${IniFile}" "Settings" "doleash" "${doleash}" 
/ini "${IniFile}" "Settings" "leashholder" "${leashholder}" 
} 
} 
} 
}
:end 
/return 

Sub Xuzl 
:wait1 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait1 
/if (${Target.CurrentHPs}<=${Math.Calc[${xuzlperc}-15]} || ${Target.Distance}>175) /return 
/if (!${Me.Moving} && ${Me.AltAbilityReady["246"]} && ${Me.AltAbility["246"]}>0 && !${Me.Casting.ID}) { 
/call cast "246" alt 7s 
/delay 5 
:wait2 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait2 
} else if (!${Me.Moving} && ${Me.AltAbilityReady["208"]} && ${Me.AltAbility["208"]}>0 && !${Me.Casting.ID}) { 
/call cast "208" alt 7s 
/delay 5 
:wait3 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait3 
} 
/return 

Sub Junk 
/call LoadJunkBuffs 
/return 

Sub Harvestcheck 
/if (${doharvest}<1) /return 
/if ((${Target.PctHPs}>=0) && (${Target.PctHPs}<75)) /return
/if (${Me.PctMana}<=${harvestpercent} && !${Me.Moving} && (${Me.SpellReady["Patient Harvest"]} || ${Me.SpellReady["Patient Harvest Rk. II"]} || ${Me.SpellReady["Harvest"]}) && !${Me.Casting.ID}) { 
/if (${Me.SpellReady["Patient Harvest Rk. II"]} && ${Me.PctMana}<50) {
	/call Cast "Patient Harvest Rk. II" ${harvestgem} 7s 
	/if (${Macro.Return.Equal[CAST_SUCCESS]}) /delay 13s ${Me.PctHPs}<30
} else {
	/if (${Me.SpellReady["Patient Harvest"]} && ${Me.PctMana}<50) {
		/call Cast "Patient Harvest" ${harvestgem} 7s 
		/if (${Macro.Return.Equal[CAST_SUCCESS]}) /delay 13s ${Me.PctHPs}<30
	} else {
		/if (${Me.SpellReady["Harvest"]}) /call Cast "Harvest" ${harvestgem} 7s
	}
}
/delay 2 
:wait1 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait1 
/if (${Me.Stunned}) { 
/delay 10s !${Me.Stunned} 
} 
} 
/if (${Me.PctMana}<=${harvestpercent} && !${Me.Moving} && ${Me.AltAbilityReady["172"]} && ${Me.AltAbility["172"]}>0 && !${Me.Casting.ID}) { 
/call Cast "172" alt 7s 
/delay 8 
:wait2 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait2 
} 
/return 

Sub Medcheck 
/if (${medtoggle}<1) /return 
/if (${Me.PctMana}<=${medpercent} && !${Me.Moving} && !${Me.Casting.ID} && ${medtoggle}>0) { 
/echo Medding up, at ${Me.PctMana} mana. 
/tell ${mainassist1} OOM, medding up.
} else { 
/goto :end 
} 
:Medloop 

/doevents 

/if (${doleash}>0) /call Leash 
/if (${Cursor.ID} && ${Cursor.Name.Equal[Rod of Mystical Transvergance]}) /autoinv 
/if (${modrod}>0 && ${Me.PctMana}<=${rodpercent} && ${hasrod}>0 && !${rodtimer}) /call Modrod 
/if (${forceshield}>0) /call Forceshield 
/if (!${clicktimer}) /call ClickBuffcheck 
/if (${doharvest}>0 && ${Me.PctMana}<=${harvestpercent}) { 
/if ((${Me.AltAbilityReady["Harvest of Druzzil"]} && ${Me.AltAbility["Harvest of Druzzil"]}>0) || ${Me.SpellReady["Patient Harvest"]} || ${Me.SpellReady["Harvest"]}) { 
/echo Harvest Ready, stopping meditation and casting. 
/if (${Me.Sitting}) /sit off 
/call Harvestcheck 
/echo Resuming Meditation 
} 
} 
/if (${Cursor.ID} && ${Cursor.Name.Equal[Rod of Mystical Transvergance]}) /autoinv 
/if (${Me.CountBuffs}>=${maxbuffs}) /call Junk 
/if (${SpawnCount[npc radius 40 zradius 20 noalert ${AlertList}]}>0) { 
/varset npcnum ${SpawnCount[npc radius 40 zradius 20 noalert ${AlertList}]} 
/for m 1 to ${npcnum} step 1 
/echo medcheckengage??? ${NearestSpawn[${m}, npc noalert ${AlertList}].LineOfSight}
/if (${NearestSpawn[${m}, npc noalert ${AlertList}].LineOfSight}) { 
	/if (!${Me.Mount.ID} && ${Me.Sitting}) {
	/sit off 
	/call Assistcheck
	/if ((${Target.CurrentHPs}<=${mobhealth})&&(!${Me.Moving})&&(${Me.TargetOfTarget.ID}==${NearestSpawn[${tankname}].ID})&&(!${Target.Type.Equal[Corpse]})&&(${Target.LineOfSight})&&(${Target.Type.Equal[NPC]})) { 
		/if (${dosnare}>0 && ${Me.PctMana}>3 && ${Target.CurrentHPs}<=${snareperc}) /call Snare
		/if (${tempstaff}>0) /call Debuff
		/if (${dodmgclicky1}>0 && ${FindItem[${DmgClicky1}].Timer}<1) /call DmgClicky1
		/if (!${Target.Type.Equal[Corpse]}) /if (${dodmgclicky2}>0 && ${FindItem[${DmgClicky2}].Timer}<1) /call DmgClicky2
		}
	}
} 
} else { 
/next m 
/if (!${Me.Mount.ID} && !${Me.Sitting} && !${Me.Moving} && ${Me.PctMana}<${manatomedup}) /sit on 
} 
/if (${Me.PctMana}<${manatomedup} && ${medtoggle}>0) /goto :Medloop 
/if (${Me.Sitting}) /sit off 
/echo Finished Medding at ${Me.PctMana} mana. 
:end 
/return 

sub Forceshield 
/if ((${Me.Buff["Scales of the Crystalwing"].ID})||(${Me.Buff["Scales of the Crystalwing Rk. II"].ID})||(${Me.Buff["Barrier of Force"].ID})||(${Me.Buff["Force Shield"].ID})||(${Me.Buff["Ether Skin"].ID})) /return 
/if (${SpawnCount[npc radius 30 zradius 20 noalert ${AlertList}]}>0) /return
/if (${forceshield}<1) /return 
/if (${Me.CountBuffs}>=${maxbuffs}) /call Junk 
/if (${useepic}<1) /goto :forceshield 
:epic 
/if (${Me.Buff["Spiritual Dominion"].ID}) { 
/if (!${Me.Buff["Barrier of Force"].ID} && !${Me.Buff["Force Shield"].ID} && !${Me.Buff["Ether Skin"].ID}) { 
/echo Spiritual Dominion detected, using Force Shield. 
/goto :forceshield 
} 
} 
/if (!${Me.Buff["Barrier of Force"].ID} && !${Me.Buff["Force Shield"].ID} && !${Me.Buff["Ether Skin"].ID}) { 
/if (!${Me.Casting.ID} && !${Me.Moving}) /call ItemFinder "Staff of the Four" 
/if (${Macro.Return.Equal["INVENTORY"]}) /call IteminInvSlot "Staff of the Four" 
/if (${Macro.Return.Equal["BAGGED"]}) /call IteminBag "Staff of the Four" 
/if (${Macro.Return.Equal["EQUIPPED"]}) /call RightClickItem "Staff of the Four" 
/goto :end 
} 
:forceshield 
/if (${useepic}>0 && !${Me.Buff["Spiritual Dominion"].ID}) /return 
/if (${forceshield}<1) /return 
/if (!${Me.Buff["Scales of the Crystalwing Rk. II"].ID} && !${Me.Buff["Scales of the Crystalwing"].ID} && !${Me.Buff["Force Shield"].ID} && !${Me.Buff["Rune of Zebuxoruk"].ID} && !${Me.Buff["Ether Skin"].ID}) { 
/if (!${Me.Casting.ID} && !${Me.Moving}) { 
/if (${usetimewand}<1) { 
:force 
/call Cast "${forcespell}" ${forcegem} 7s 
/if (${Macro.Return.Equal[CAST_NOTREADY]}) /goto :force 
} 
/if (${usetimewand}>0) { 
/call ItemFinder "Wand of Impenetrable Force" 
/if (${Macro.Return.Equal["INVENTORY"]}) /call IteminInvSlot "Wand of Impenetrable Force" 
/if (${Macro.Return.Equal["BAGGED"]}) /call IteminBag "Wand of Impenetrable Force" 
/if (${Macro.Return.Equal["EQUIPPED"]}) /call RightClickItem "Wand of Impenetrable Force" 
} 
:wait2 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait2 
} 
} 
:end 
/return 

Sub ClickBuffcheck 
/if (${Me.Casting.ID} || ${Me.Moving} || ${clicktimer}) /goto :DoneItemChecks 
/varset m 1 
:ItemCheckLoop 
/varset ialias ${Ini[${IniFile}].Arg[${m},|]} 
/if (${ialias.NotEqual[NULL]}) { 
  /if (${Ini[${IniFile},${ialias},KeepUp].Equal[FALSE]}) /goto :NextItem 
  /varset bouncenum 1 
  /varset doiclick 1 
  :BounceCheckLoop 
  /varset ibounce ${Ini[${IniFile},${ialias},BounceOff${bouncenum}]} 
  /if (${ibounce.NotEqual[NULL]}) { 
    /if (${ibounce.Equal[${Me.Buff[${ibounce}]}]}) /varset doiclick 0 
    } else /goto :DoneBounceChecks 
  /varcalc bouncenum ${bouncenum}+1 
  /goto :BounceCheckLoop 
  :DoneBounceChecks 
  /varset itemspellname ${FindItem[${Ini[${IniFile},${ialias},FullName]}].Spell} 
  /if (${itemspellname.Equal[${Me.Buff[${itemspellname}]}]}) /varset doiclick 0 
  /if (${doiclick}>0) { 
    /if (${Cursor.ID}) /autoinv 
    /if (${FindItem[${Ini[${IniFile},${ialias},FullName]}].Spell.TargetType.Equal[Self]}) /keypress F1 
    /docommand /iclick ${ialias} 
    } 
  /if (${clicktimer}) /goto :DoneItemChecks 
  :NextItem 
  /varcalc m ${m}+1 
  } else /goto :DoneItemChecks 
/goto :ItemCheckLoop 
:DoneItemChecks 
/varset clicktimer 2s 
/return 

Sub Buffcheck 
:forceshield 
/call Forceshield 
:shieldofmaelin 
/if (${shieldofmaelin}<1) /goto :spellshield 
/for n 1 to 20 step 1 
/if (${Me.Buff[${n}].ID}>0) { 
/if (!${Spell[${shieldspell}].Stacks}) /goto :spellshield 
} 
/next n 
/if (!${Me.Buff["Shield of Maelin"].ID} && !${Me.Buff["Ether Shield"].ID}  && !${Me.Buff["Shield of the Crystalwing"].ID} !${Me.Buff["Shield of the Crystalwing Rk. II"].ID} !${Me.Buff["Shield of the Crystalwing Rk. III"].ID} && !${Me.Casting.ID} && !${Me.Moving}) { 
/if (${Me.CountBuffs}>=${maxbuffs}) /call Junk 
/call Cast "${shieldspell}" ${maelingem} 7s 
:wait6
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait6 
} 
:spellshield 
/if (${spellshield}>0) /call Spellshield 
:manaward 
/if (${manaward}>0) /call Manaward 
:familiar 
/if (${checkfamiliar}<1) /return 
/for m 1 to 20 step 1 
/if (${Me.Buff[${m}].ID}>0) { 
/if (${Me.Buff[${m}].Name.Find["familiar"]}) /return 
} 
/next m 
/if (${Me.AltAbilityReady["${myfamiliar}"]} && ${Me.AltAbility["${myfamiliar}"]}>0 && !${Me.Casting.ID} && !${Me.Moving}) { 
/if (${Me.CountBuffs}>=${maxbuffs}) /call Junk 
/call cast "${myfamiliar}" alt 7s 
/delay 8 
:wait9 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait9 
/if (${Me.Pet.ID} && ${Me.Pet.Name.Find[familiar]}) /pet get lost 
} 
/return 

Sub Snare 
/varset Mobsnared 0
/call ItemFinder "Dagger of Entrapment" 
/if (${Macro.Return.Equal["NOTFOUND"]}) /goto :snare 
/if (${Macro.Return.Equal["EQUIPPED"]} || ${Macro.Return.Equal["INVENTORY"]}) /goto :snare2 
/if (${Macro.Return.Equal["BAGGED"]}) /goto :snare3 
:snare 
/varset retrycount ${Math.Calc[${retrycount}+1]} 
:recast 
/call cast "${snarespell}" ${snaregem} 7s 
/if (${Macro.Return.Equal["CAST_NOTREADY"]}) /goto :recast 
/delay 3
/doevents Snaresuccess
/if ((${Macro.Return.Equal["CAST_RESISTED"]} || ${Mobsnared}<1) && ${Target.ID}) /goto :snare 
/if (${Macro.Return.Equal["CAST_INVIS"]}) /goto :snare
/varset snaretimer 600 
/varset retrycount 0 
:wait2 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait2 
/goto :done 
:snare2 
/varset retrycount ${Math.Calc[${retrycount}+1]} 
/call RightClickItem "Dagger of Entrapment" 
/if ((${Macro.Return.Equal["CAST_RESISTED"]} || ${Mobsnared}<1) && ${Target.ID}) /goto :snare2 
/varset snaretimer 600 
/varset retrycount 0 
/goto :done 
:snare3 
/call EquipFromBag "Dagger of Entrapment" 
/varset retrycount ${Math.Calc[${retrycount}+1]} 
/call RightClickItem "Dagger of Entrapment" 
/if ((${Macro.Return.Equal["CAST_RESISTED"]} || ${Mobsnared}<1) && ${Target.ID}) /goto :snare3 
/varset snaretimer 600
/varset retrycount 0 
/if (!${olditem.Equal[NULL]}) { 
/call ItemFinder "${olditem}" "${wornslot}" 
/if (${Macro.Return.Equal["BAGGED"]}) /call EquipFromBag "${olditem}" "${wornslot}" 
/varset olditem NULL 
/varset wornslot NULL 
} 
:done 
/echo Snaresub done.
/return 

Sub DmgClicky1
/if (${Target.Distance}>200) { 
/echo ${Target.CleanName} is too far away to use ${DmgClicky1}. 
/goto :done 
} 
/call ItemFinder "${DmgClicky1}" 
/if (${Macro.Return.Equal["EQUIPPED"]} || ${Macro.Return.Equal["INVENTORY"]}) /goto :useDmgClicky1
/if (${Macro.Return.Equal["BAGGED"]}) /call EquipFromBag "${DmgClicky1}" 
:useDmgClicky1
/itemnotify ${FindItem[${DmgClicky1}].InvSlot} rightmouseup
/if (!${olditem.Equal[NULL]}) { 
/call ItemFinder "${olditem}" "${wornslot}" 
/if (${Macro.Return.Equal["BAGGED"]}) /call EquipFromBag "${olditem}" "${wornslot}" 
/varset olditem NULL 
/varset wornslot NULL 
} 
:done
/return

Sub DmgClicky2
/if (${Target.Distance}>200) { 
/echo ${Target.CleanName} is too far away to use ${DmgClicky2}. 
/goto :done 
} 
/call ItemFinder "${DmgClicky2}" 
/if (${Macro.Return.Equal["EQUIPPED"]} || ${Macro.Return.Equal["INVENTORY"]}) /goto :useDmgClicky2
/if (${Macro.Return.Equal["BAGGED"]}) /call EquipFromBag "${DmgClicky2}" 
:useDmgClicky2
/itemnotify ${FindItem[${DmgClicky2}].InvSlot} rightmouseup
/if (!${olditem.Equal[NULL]}) { 
/call ItemFinder "${olditem}" "${wornslot}" 
/if (${Macro.Return.Equal["BAGGED"]}) /call EquipFromBag "${olditem}" "${wornslot}" 
/varset olditem NULL 
/varset wornslot NULL 
} 
:done
/return

Sub Modrod 
/if (${Me.PctMana}>${rodpercent} || ${hasrod}<1) /return 
/call ItemFinder "Rod of Mystical Transvergance" 
/if (${Macro.Return.Equal["NOTFOUND"]}) { 
/varset hasrod 0 
/echo Unable to find your Rod of Mystical Transvergance. 
} 
/if (${Macro.Return.Equal["EQUIPPED"]} || ${Macro.Return.Equal["INVENTORY"]}) { 
/itemnotify ${FindItem[Rod of Mystical Transvergance].InvSlot} rightmouseup 
/varset rodtimer 3100 
/echo Mod Rodded 
} 
/if (${Macro.Return.Equal["BAGGED"]}) { 
/call IteminBag "Rod of Mystical Transvergance" 
/varset rodtimer 3100 
/echo Mod Rodded 
} 
/return 

Sub Manaward 
:manaward 
/if (${manaward}<1) /return 
/if (!${Me.Buff["Mana Ward"].ID} && ${Me.SpellReady["Mana Ward"]} && !${Me.Casting.ID} && !${Me.Moving}) { 
/if (${Me.CountBuffs}>=${maxbuffs}) /call Junk 
/call cast "Mana Ward" ${manawardgem} 7s 
/delay 1 
:wait8 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait8 
} 
/return 

Sub Spellshield 
:spellshield 
/if (${spellshield}<1) /return 
/if (!${Me.Buff["Spellshield"].ID} && !${Me.Casting.ID} && !${Me.Moving}) { 
/keypress F1 
/delay 1 
:wand1 
/if (${Me.CountBuffs}>=${maxbuffs}) /call Junk 
/call ItemFinder "Wand of Turning" 
/if (${Macro.Return.Equal["NOTFOUND"]}) /goto :wand2 
/if (${Macro.Return.Equal["EQUIPPED"]} || ${Macro.Return.Equal["INVENTORY"]}) { 
/call RightClickItem "Wand of Turning" 
/goto :end 
} 
/if (${Macro.Return.Equal["BAGGED"]}) { 
/call IteminBag "Wand of Turning" 
/goto :end 
} 
:wand2 
/call ItemFinder "Wand of Deflection" 
/if (${Macro.Return.Equal["NOTFOUND"]}) /goto :nowand 
/if (${Macro.Return.Equal["EQUIPPED"]} || ${Macro.Return.Equal["INVENTORY"]}) { 
/call RightClickItem "Wand of Deflection" 
/goto :end 
} 
/if (${Macro.Return.Equal["BAGGED"]}) { 
/call IteminBag "Wand of Deflection" 
/goto :end 
} 
:nowand 
/call cast "Spellshield" ${ssgem} 7s 
/delay 1 
:wait7 
| /if (${Me.Casting.ID} || ${Me.Moving} || !${Me.SpellReady["Spellshield"]}) /goto :wait7 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :Wait7 
} 
:end 
/if (${mobid}!=0) /squelch /target id ${mobid} 
/return 

Sub Manarobe 
/if (${Me.PctMana}>${beginrobe} || ${hasrobe}<1) /return 
/if (${Cursor.ID}) /autoinv 
/call ItemFinder "Mana Robe" 
/if (${Macro.Return.Equal["NOTFOUND"]}) { 
/varset hasrobe 0 
/echo Unable to find your Mana Robe. 
/goto :done 
} 
/echo Beginning to Manarobe 
/call ItemFinder "Mana Robe" 
/if (${Macro.Return.Equal["EQUIPPED"]}) /goto :loop 
/if (${Macro.Return.Equal["INVENTORY"]}) /call EquipFromInvSlot "Mana Robe" 
/if (${Macro.Return.Equal["BAGGED"]}) /call EquipFromBag "Mana Robe" 
:loop 

/doevents 

/if (${Me.PctMana}>=${donerobe} || ${Me.PctHPs}<=30) /goto :End 
/call RightClickItem "Mana Robe" 
/if (${forceshield}<1) /goto :wait3 
/call Forceshield 
:wait3 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait3 
/if (${Me.PctMana}<${donerobe}) /goto :loop 
:End 
:wait4 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait4 
/if (!${olditem.Equal[NULL]}) { 
/call ItemFinder "${olditem}" "${wornslot}" 
/if (${Macro.Return.Equal["BAGGED"]}) /call EquipFromBag "${olditem}" "${wornslot}" 
/if (${Macro.Return.Equal["INVENTORY"]}) /call EquipFromInvSlot "${olditem}" "${wornslot}" 
/varset olditem NULL 
/varset wornslot NULL 
} 
/echo Done Manarobing. 
:done 
/return 

Sub AddMaster(MasterName) 
/declare Category string local 
/declare EachMaster int local 
/declare Master string local 
/declare BlankMaster int local 
/varset BlankMaster 0 
/varset Category Masters 
/varset EachMaster 0 
:NextMaster1 
/varset Master ${Ini[${IniFile},${Category},Master_${Int[${EachMaster}]},NOTFOUND]} 
/if (${Master.Find["NOTFOUND"]}) { 
/goto :IniParsed 
} 
/if (${Master.Find["NONE"]}) { 
/varset BlankMaster ${EachMaster} 
} 

/if (${Master.Find["${MasterName}"]}) { 
/echo ${MasterName} already on Masters List. 
/return 
} 
/varset EachMaster ${Math.Calc[${EachMaster}+1]} 
/goto :NextMaster1 
:IniParsed 
/if (${BlankMaster}==0) { 
/ini ${IniFile} "${Category}" Master_${Int[${EachMaster}]} "${MasterName}" 
} else { 
/ini ${IniFile} "${Category}" Master_${Int[${BlankMaster}]} "${MasterName}" 
} 
/echo Added ${MasterName} to the Masters list. 
/return 

Sub DelMaster(MasterName) 
/declare Category string local 
/declare EachMaster int local 
/declare Master string local 
/varset Category Masters 
/if (${Ini[${IniFile},${Category},-1,NOTFOUND].Equal["NOTFOUND"]}) { 
/echo No Master list exists. 
/return 
} 
/varset EachMaster 0 
:NextMaster3 
/varset Master ${Ini[${IniFile},${Category},Master_${Int[${EachMaster}]},NOTFOUND]} 
/if (${Master.Find["NOTFOUND"]}) { 
/call LoadMasters 
/return 
} 
/if (${Master.Find["${MasterName}"]}) { 
/echo Removed ${MasterName} from the Masters list. 
/ini ${IniFile} "${Category}" Master_${Int[${EachMaster}]} NONE 
} 
/varset EachMaster ${Math.Calc[${EachMaster}+1]} 
/goto :NextMaster3 
/return 

Sub LoadMasters(Sender, ChatText) 
/declare authorized bool local FALSE 
/declare Category string local 
/declare EachMaster int local 
/declare Master string local 
/varset Category Masters 
/if (${Ini[${IniFile},${Category},-1,NOTFOUND].Find["NOTFOUND"]}) { 
/return 
} 
/varset EachMaster 0 
:NextMaster2 
/varset Master ${Ini[${IniFile},${Category},Master_${Int[${EachMaster}]},NOTFOUND]} 
/if (${Master.Equal["NOTFOUND"]}) { 
/return 
} 
/if (${Master.Find["NONE"]}) { 
} else { 
/if (${Master.Find["${Sender}"]}) { 
/goto :authorized 
} 
} 
:next 
/varset EachMaster ${Math.Calc[${EachMaster}+1]} 
/goto :NextMaster2 

:authorized 
/echo - User ${Sender} Authenticated! 
/echo Action --> "${ChatText}" 
/if (${Me.AFK}) /delay 2s 
/docommand ${ChatText} 

/return 

Sub AddJunkBuff(JunkBuffName) 
/declare Category string local 
/declare EachJunkBuff int local 
/declare JunkBuff string local 
/declare BlankJunkBuff int local 
/varset BlankJunkBuff 0 
/varset Category Junk Buffs 
/varset EachJunkBuff 0 
:NextJunkBuff1 
/varset JunkBuff ${Ini[${IniFile},${Category},JunkBuff_${Int[${EachJunkBuff}]},NOTFOUND]} 
/if (${JunkBuff.Find["NOTFOUND"]}) { 
/goto :IniParsed 
} 
/if (${JunkBuff.Find["NONE"]}) { 
/varset BlankJunkBuff ${EachJunkBuff} 
} 

/if (${JunkBuff.Find["${JunkBuffName}"]}) { 
/echo ${JunkBuffName} already on JunkBuff List. 
/return 
} 
/varset EachJunkBuff ${Math.Calc[${EachJunkBuff}+1]} 
/goto :NextJunkBuff1 
:IniParsed 
/if (${BlankJunkBuff}==0) { 
/ini ${IniFile} "${Category}" JunkBuff_${Int[${EachJunkBuff}]} "${JunkBuffName}" 
} else { 
/ini ${IniFile} "${Category}" JunkBuff_${Int[${BlankJunkBuff}]} "${JunkBuffName}" 
} 
/echo Added ${JunkBuffName} to the Junk Buffs list. 
/return 

Sub LoadJunkBuffs 
/declare Category string local 
/declare EachJunkBuff int local 
/declare JunkBuff string local 
/varset Category Junk Buffs 
/if (${Ini[${IniFile},${Category},-1,NOTFOUND].Find["NOTFOUND"]}) { 
/return 
} 
/varset EachJunkBuff 0 
:NextJunkBuff2 
/varset JunkBuff ${Ini[${IniFile},${Category},JunkBuff_${Int[${EachJunkBuff}]},NOTFOUND]} 
/if (${JunkBuff.Equal["NOTFOUND"]}) { 
/return 
} 
/if (${JunkBuff.Find["NONE"]}) { 
} else { 
/if (${Me.CountBuffs}<${maxbuffs}) /return 
/for m 20 downto 1 step 1 
/if (${Me.Buff[${m}].ID}>0) { 
/if (${Me.CountBuffs}>=${maxbuffs}) { 
/if (${Me.Buff[${m}].Name.Find["${JunkBuff}"]}) { 
/varset buffslot ${Math.Calc[${Me.Buff[${m}].ID}-1]} 
/notify BuffWindow Buff${buffslot} leftmouseup 
/delay 1 
/goto :next 
} 
} 
} 
/next m 
} 
:next 
/varset EachJunkBuff ${Math.Calc[${EachJunkBuff}+1]} 
/goto :NextJunkBuff2 
/return 

Sub DelJunkBuff(JunkBuffName) 
/declare Category string local 
/declare EachJunkBuff int local 
/declare JunkBuff string local 
/varset Category Junk Buffs 
/if (${Ini[${IniFile},${Category},-1,NOTFOUND].Find["NOTFOUND"]}) { 
/echo No JunkBuff list exists. 
/return 
} 
/varset EachJunkBuff 0 
:NextJunkBuff3 
/varset JunkBuff ${Ini[${IniFile},${Category},JunkBuff_${Int[${EachJunkBuff}]},NOTFOUND]} 
/if (${JunkBuff.Find["NOTFOUND"]}) { 
/call LoadJunkBuffs 
/return 
} 
/if (${JunkBuff.Find["${JunkBuffName}"]}) { 
/echo Removed ${JunkBuffName} from the exclusions list. 
/ini ${IniFile} "${Category}" JunkBuff_${Int[${EachJunkBuff}]} NONE 
} 
/varset EachJunkBuff ${Math.Calc[${EachJunkBuff}+1]} 
/goto :NextJunkBuff3 
/return 

Sub AddExclude(ExcludeName) 
/declare Category string local 
/declare EachExclude int local 
/declare Exclude string local 
/declare BlankExclude int local 
/varset BlankExclude 0 
/varset Category Excludes 
/varset EachExclude 0 
:NextExclude1 
/varset Exclude ${Ini[${IniFile},${Category},exclude_${Int[${EachExclude}]},NOTFOUND]} 
/if (${Exclude.Find["NOTFOUND"]}) { 
/goto :IniParsed 
} 
/if (${Exclude.Find["NONE"]}) { 
/varset BlankExclude ${EachExclude} 
} 

/if (${Exclude.Find["${ExcludeName}"]}) { 
/echo ${ExcludeName} already on Exclude List. 
/return 
} 
/varset EachExclude ${Math.Calc[${EachExclude}+1]} 
/goto :NextExclude1 
:IniParsed 
/if (${BlankExclude}==0) { 
/ini ${IniFile} "${Category}" exclude_${Int[${EachExclude}]} "${ExcludeName}" 
} else { 
/ini ${IniFile} "${Category}" exclude_${Int[${BlankExclude}]} "${ExcludeName}" 
} 
/echo Added ${ExcludeName} to the exclusions list. 
/squelch /alert add ${AlertList} NPC "${ExcludeName}" 
/return 

Sub LoadExcludes 
/declare Category string local 
/declare EachExclude int local 
/declare Exclude string local 
/varset Category Excludes 
/squelch /alert clear ${AlertList} 
/squelch /alert add ${AlertList} afnuke.mac 
/squelch /alert add ${AlertList} NPC "eye of " 
/if (${Ini[${IniFile},${Category},-1,NOTFOUND].Find["NOTFOUND"]}) { 
/echo No Exclude list exists. 
/return 
} 
/varset EachExclude 0 
:NextExclude2 
/varset Exclude ${Ini[${IniFile},${Category},exclude_${Int[${EachExclude}]},NOTFOUND]} 
/if (${Exclude.Equal["NOTFOUND"]}) { 
/return 
} 
/if (${Exclude.Find["NONE"]}) { 
} else { 
/squelch /alert add ${AlertList} NPC "${Exclude}" 
} 
/varset EachExclude ${Math.Calc[${EachExclude}+1]} 
/goto :NextExclude2 
/return 

Sub CheckExcludes 
/if (${SpawnCount[npc radius ${engagedistance} zradius 20 alert ${AlertList}]}>0) { 
/varset npcnum ${SpawnCount[npc radius ${engagedistance} zradius 20 alert ${AlertList}]} 
/for m 1 to ${npcnum} step 1 
/if (${NearestSpawn[${m}, npc alert ${AlertList}].ID}==${mobid}) { 
/varset mobid 0 
/varset engagedmob 0 
/goto :end 
} 
} 
/next m 
:end 
/return 

Sub DelExclude(ExcludeName) 
/declare Category string local 
/declare EachExclude int local 
/declare Exclude string local 
/varset Category Excludes 
/if (${Ini[${IniFile},${Category},-1,NOTFOUND].Find["NOTFOUND"]}) { 
/echo No Exclude list exists. 
/return 
} 
/varset EachExclude 0 
:NextExclude3 
/varset Exclude ${Ini[${IniFile},${Category},exclude_${Int[${EachExclude}]},NOTFOUND]} 
/if (${Exclude.Find["NOTFOUND"]}) { 
/call LoadExcludes 
/return 
} 
/if (${Exclude.Find["${ExcludeName}"]}) { 
/echo Removed ${ExcludeName} from the exclusions list. 
/ini ${IniFile} "${Category}" exclude_${Int[${EachExclude}]} NONE 
} 
/varset EachExclude ${Math.Calc[${EachExclude}+1]} 
/goto :NextExclude3 
/return 

sub ItemFinder(item) 
/varset bag ${FindItem[${item}].InvSlot.Pack} 
/varset slot ${FindItem[${item}].InvSlot} 
/declare equipslot string local ${FindItem[${item}].WornSlot[1].Name} 
/declare equipslot2 string local ${FindItem[${item}].WornSlot[2].Name} 
/declare equipslot3 string local ${FindItem[${item}].WornSlot[3].Name} 
/if ((${bag}==0)&&(${slot}==0)) /return NOTFOUND 
/if ((${Me.Inventory[${equipslot}].Name.Equal[${item}]})) /return EQUIPPED 
/if ((${Me.Inventory[${equipslot2}].Name.Equal[${item}]})) /return EQUIPPED 
/if ((${Me.Inventory[${equipslot3}].Name.Equal[${item}]})) /return EQUIPPED 
/if (${bag}==0 && ${slot}>0) /return INVENTORY 
/if (${bag}>0 && ${slot}>0) /return BAGGED 
/return

Sub EquipFromBag(item) 
/varset bag ${FindItem[${item}].InvSlot.Pack} 
/varset slot ${FindItem[${item}].InvSlot} 
/declare equipslot string local ${FindItem[${item}].WornSlot[1].Name} 
/if (!${Window[InventoryWindow].Open}) /keypress Inventory 
/itemnotify ${InvSlot[${bag}]} rightmouseup 
/delay 1 
/itemnotify ${equipslot} leftmouseup 
/varset olditem ${Cursor.Name} 
/varset wornslot ${Cursor.WornSlot[1].Name} 
/delay 1 
/itemnotify ${InvSlot[${slot}]} leftmouseup 
/delay 1 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
/itemnotify ${InvSlot[${bag}]} rightmouseup 
/if (${Window[InventoryWindow].Open}) /keypress Inventory 
/return 

Sub EquipFromInvSlot(item) 
/varset slot ${FindItem[${item}].InvSlot} 
/declare equipslot string local ${FindItem[${item}].WornSlot[1].Name} 
/if (!${Window[InventoryWindow].Open}) /keypress Inventory 
/itemnotify ${equipslot} leftmouseup 
/varset olditem ${Cursor.Name} 
/varset wornslot ${Cursor.WornSlot[1].Name} 
/delay 1 
/itemnotify ${InvSlot[${slot}]} leftmouseup 
/delay 1 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
/if (${Window[InventoryWindow].Open}) /keypress Inventory 
/return 

Sub IteminBag(item) 
/declare charges int local ${FindItem[${item}].Charges} 
/varset bag ${FindItem[${item}].InvSlot.Pack} 
/varset slot ${FindItem[${item}].InvSlot} 
/declare equipslot string local ${FindItem[${item}].WornSlot[1].Name} 
/if (!${Window[InventoryWindow].Open}) /keypress Inventory 
/itemnotify ${InvSlot[${bag}]} rightmouseup 
/delay 1 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
/itemnotify ${InvSlot[${slot}]} leftmouseup 
/delay 1 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
/call RightClickItem "${item}" 
/if ( ${charges}>0 ) /delay 2s ${FindItem[${item}].Charges}!=${charges} 
/if ((${Me.Inventory[${equipslot}].Name.Equal[${item}]})||(${Me.Inventory[${equipslot}s].Name.Equal[${item}]})) { 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
} 
/delay 1 
/itemnotify ${InvSlot[${slot}]} leftmouseup 
/delay 1 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
/itemnotify ${InvSlot[${bag}]} rightmouseup 
/delay 1 
/if (${Window[InventoryWindow].Open}) /keypress Inventory 
/return 

Sub IteminInvSlot(item) 
/varset slot ${FindItem[${item}].InvSlot} 
/declare equipslot string local ${FindItem[${item}].WornSlot[1].Name} 
/if (!${Window[InventoryWindow].Open}) /keypress Inventory 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
/itemnotify ${InvSlot[${slot}]} leftmouseup 
/delay 1 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
/call RightClickItem "${item}" 
/if ((${Me.Inventory[${equipslot}].Name.Equal[${item}]})||(${Me.Inventory[${equipslot}s].Name.Equal[${item}]})) { 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
} 
/itemnotify ${InvSlot[${slot}]} leftmouseup 
/delay 1 
/itemnotify ${equipslot} leftmouseup 
/delay 1 
/itemnotify ${InvSlot[${bag}]} rightmouseup 
/delay 1 
/if (${Window[InventoryWindow].Open}) /keypress Inventory 
/return 

Sub RightClickItem(item) 
| /if (${FindItem[${item}].Spell.TargetType.Equal[Self]}) { 
| /call cast "${item}" item nocheck 
| } else { 
| /call cast "${item}" item ${checktarget} 
| } 
/call cast "${item}" item 7s 
/delay 2 
/if ((${Macro.Return.Equal["CAST_RESISTED"]})||(${Macro.Return.Equal["CAST_INVIS"]})) /return ${Macro.Return} 
:wait1 
/if (${Me.Casting.ID} || ${Me.Moving}) /goto :wait1 
/return